unit ULibFormularioLoading;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, GIFImg, ExtCtrls, ComCtrls, StdCtrls;

type
  TfrmLoading = class(TForm)
    lblMensagem: TLabel;
    Animate1: TAnimate;
  private
    { Private declarations }
    FClose: Boolean;
  public
    { Public declarations }
    procedure Processing(AMessage: String; ACommonStyle: TCommonAVI;
      AFileName: String = '');
    procedure Stop;
  end;

var
  frmLoading: TfrmLoading;

implementation

uses
  ShellAnimations;

{$R *.dfm}
{ TfrmLoading }

procedure TfrmLoading.Processing(AMessage: String; ACommonStyle: TCommonAVI;
  AFileName: String);
begin
  try
    FClose := False;
    Self.Animate1.Active := False;
    Application.ProcessMessages;
    lblMensagem.Caption := AMessage;
    Application.ProcessMessages;
    Self.Animate1.CommonAVI := ACommonStyle;
    Application.ProcessMessages;
    Self.Animate1.FileName := AFileName;
    Application.ProcessMessages;
  finally
    Self.Animate1.Active := True;
    Application.ProcessMessages;
  end;
end;

procedure TfrmLoading.Stop;
begin
  FClose := True;
  Self.Close;
end;

end.
